package reflect;



import java.lang.reflect.Constructor;

public class ReflectDemo3 {
    public static void main(String[] args) throws Exception {
        Person per = new Person("Lrx");
        System.out.println(per);

        Class cls=Class.forName("reflect.Person");
        Constructor c = cls.getConstructor(String.class);
        Object o = c.newInstance("Lrx1");
        System.out.println(o);

        Constructor con=cls.getConstructor(String.class,int.class);
        Object obj=con.newInstance("Lrx2",22);
        System.out.println(obj);
    }
}
